<?php

	include_once "../../../config.inc.php";
	
	$idElement = $_GET["id"];
	$typeElement = $_GET["element"];
				
	$deleteQuery = "";
	$connection = pg_connect("host=".W." port=".V." dbname=".Z." user=".Y." password=".X) or die ("Falló la conexion");
	
		switch ($typeElement){
														
		case MENU_ELEMENT: $deleteQuery = "DELETE FROM MENU_ELEMENT WHERE ELEMENT_ID = ".$idElement.";";
						   $delete = pg_query($connection,$deleteQuery);			
							break;
							
		case IMAGE_ELEMENT: $deleteQuery = "DELETE FROM IMAGE_ELEMENT WHERE ELEMENT_ID = ".$idElement.";";
						    $delete = pg_query($connection,$deleteQuery);			
							break;
							
		case TEXT_ELEMENT:  $deleteQuery = "DELETE FROM ELEMENT_TEXT WHERE ELEMENT_ID = ".$idElement.";";
						    $delete = pg_query($connection,$deleteQuery);			
							break;
							
		case MENU_LIST:     $deleteQuery = "DELETE FROM MENU_ELEMENT WHERE MEN_ELEMENT_ID = ".$idElement.";";
						    $delete = pg_query($connection,$deleteQuery);
							
							$deleteQuery = "DELETE FROM MENU_LIST WHERE ELEMENT_ID = ".$idElement.";";
						    $delete = pg_query($connection,$deleteQuery);			
							break;
							
		case GALLERY_ELEMENT: $deleteQuery = "DELETE FROM IMAGE_ELEMENT WHERE GAL_ELEMENT_ID = ".$idElement.";";
						      $delete = pg_query($connection,$deleteQuery);
							
							$deleteQuery = "DELETE FROM GALLERY_ELEMENT WHERE ELEMENT_ID = ".$idElement.";";
						    $delete = pg_query($connection,$deleteQuery);
							break;
							
		}
	?>